package com.longfa.ojbackendjudgeservice.codesandbox.impl;

import com.longfa.ojbackendjudgeservice.codesandbox.CodeSandbox;
import com.longfa.ojbackendmodel.model.codesandbox.ExecuteCodeRequest;
import com.longfa.ojbackendmodel.model.codesandbox.ExecuteCodeResponse;
import com.longfa.ojbackendmodel.model.codesandbox.JudgeInfo;
import com.longfa.ojbackendmodel.model.enums.JudgeInfoMessageEnum;
import com.longfa.ojbackendmodel.model.enums.QuestionSubmitStatusEnum;

import java.util.List;

/**
 * ClassName: ExampleCodeSandbox
 * Package: com.fa.oj.judge.codesandbox.impl
 * Description: 示例代码沙箱（仅为了跑通业务流程）
 *
 * @Author:
 * @Create: 2024/4/23 - 15:01
 * @Version: v1.0
 */
public class ExampleCodeSandbox implements CodeSandbox {
    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        List<String> inputList = executeCodeRequest.getInputList();

        ExecuteCodeResponse executeCodeResponse = new ExecuteCodeResponse();
        executeCodeResponse.setOutputList(inputList);
        executeCodeResponse.setMessage("测试成功");
        executeCodeResponse.setStatus(QuestionSubmitStatusEnum.SUCCEED.getValue());
        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage(JudgeInfoMessageEnum.ACCEPTED.getValue());
        judgeInfo.setMemory(100L);
        judgeInfo.setTime(100L);
        executeCodeResponse.setJudgeInfo(judgeInfo);

        return executeCodeResponse;
    }
}
